﻿@model Utilities.ViewModel.PagedList<Home.Domain.Entities.MessageBoard>
@using Utilities.ViewModel.HtmlHelpers
@{
    ViewBag.SidebarId = 5;
    ViewBag.Title = "留言列表";
    Layout = "~/Areas/Mythi/Views/Shared/_Layout.cshtml";
}
@section loadend{
    $("[name='Delete']").click(
    function () {
        if (confirm("确定要删除\"" + $(this).attr("tip") + "\"吗？")) {
            var stuid = $(this).attr("stuid");
            var tr = $(this).parent().parent();
            $.post("@Url.Action("Delete")", { id: stuid }, function (data) {
                 if (data == "-1") { alert("删除失败"); }
                 if (data > 0) {
                     alert("此分类中有" + data + "项");
                 }
                 else {
                     $(tr).remove(); alert("删除成功");
                 }
             });
         }
    });
    }
<form action="@Url.Action("index")" method="get" class="form-search">
     <label class="control-label" for="inputEmail">内容：</label>
  <input type="text" value="@Model.Search" name="Search" class="input-medium ">
  <button type="submit" class="btn">搜索</button>
</form>

<table class="table table-bordered">
  <thead>
    <tr>
      <th>联系人</th>
         <th>联系方式</th>
        <th>内容</th>
         <th>日期</th>
      <th>操作</th>
    </tr>
  </thead>
    <tbody>
        @foreach (var item in Model.Entities)
        {
            <tr>
                <td>@item.Name</td>
                <td>@item.Contact</td>
                <td>@item.Body</td>
                <td>@string.Format("{0:yyyy-MM-dd HH:mm:ss}",item.CreateDate)</td>
                <td>
                  @* <a href="@Url.Action("Edit", new {id=item.Id })">编辑</a>*@ <a href="javascript:void(0)" name="Delete" tip="@item.Name" stuid="@item.Id">删除</a>
                </td>
            </tr>
       }
    </tbody>
</table>
                 <div class="pagination pagination-right">
  <ul>
        @Html.PageLinks(Model.PagingInfo, x => Url.Action("index", new { Page = x }))
   @* <li><a href="#">前一页</a></li>
    <li class="active">
      <a href="#">1</a>
    </li>
    <li><a href="#">2</a></li>
    <li><a href="#">3</a></li>
    <li><a href="#">4</a></li>
    <li><a href="#">后一页</a></li>*@
  </ul>
</div>

